<#assign pageName="工作流模型管理">
<@override name="page-content">
<form class="form-horizontal" role="form" method="post" id="formModelMgr">
     <div class="layui-form-search panel">
         <input type="text" hidden="hidden" name="_STATE"/>
         <div class="pull-left padding-5">
              <a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-sm js_add">
                <i class="layui-icon layui-icon-addition"></i>新增流程模型
              </a>
          </div>
    </div>
    <table class="layui-table">
        <thead>
            <tr>
                <th class="align-center" width="50px" nowrap="nowrap">序号</th>
                <th class="align-center" nowrap="nowrap">流程KEY</th>
                <th class="align-center" nowrap="nowrap">流程名称</th>
                <th class="align-center" nowrap="nowrap">流程版本</th>
                <th class="align-center layui-hide-xs" nowrap="nowrap">创建时间</th>
                <th class="align-center layui-hide-xs" nowrap="nowrap">更新时间</th>
                <th class="align-center layui-hide-xs" nowrap="nowrap">导出</th>
                <th width="130px" class="align-center">操作</th>
            </tr>
        </thead>

        <tbody>
        <#if queryResult.rows?has_content>
            <#list queryResult.rows as dataItem>  
            <tr>
                <td class="align-center" width="50px" nowrap="nowrap">
                    ${(pageNo-1)*pageSize+dataItem_index+1}
                </td>
                <td class="align-center" nowrap="nowrap">
                    ${dataItem.key}
                </td>
                <td nowrap="nowrap">
                    ${dataItem.name}
                </td>
                <td class="align-center" nowrap="nowrap">
                    ${dataItem.version}
                </td>
                <td class="align-center layui-hide-xs" nowrap="nowrap">
                    ${dataItem.createTime?string('yyyy-MM-dd HH:mm:ss')}
                </td>
                <td class="align-center layui-hide-xs" nowrap="nowrap">
                    ${dataItem.lastUpdateTime?string('yyyy-MM-dd HH:mm:ss')}
                </td>
                <td class="align-center layui-hide-xs">
                    <a href="export/${dataItem.id}/bpmn" target="_blank">BPMN</a>
                    <a href="export/${dataItem.id}/json" target="_blank">JSON</a>
                    <a href="javascript:;" onclick='showSvgTip()'>SVG</a>
                </td>
                <td class="align-center">
                    <div class="layui-table-cell">
                        <a href="${contextPath}/modeler.html?modelId=${dataItem.id}"  target="_blank" class="layui-btn layui-btn-xs layui-btn-warm">
                            <i class="layui-icon layui-icon-edit"></i>编辑
                        </a>
                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal"
                             onclick="confirmSubmit('确定要部署模型‘${dataItem.name}’吗？',{}, 'deploy/${dataItem.id}')">
                            <i class="layui-icon layui-icon-release"></i>部署
                        </button>
                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger"
                            onclick="confirmSubmit('确定要删除模型‘${dataItem.name}’吗？', {modelId:'${dataItem.id}'},'del')">
                            <i class="layui-icon layui-icon-delete"></i>删除
                        </button>
                    </div>
                </td>
            </tr>
            </#list>
         <#else>
            <tr class="align-center">
                <td style="color:red;font-weight:bold;" colspan="11">暂无符合条件的流程模型信息</td>
            </tr>
        </#if>
        </tbody>
    </table>
   <@ctrl.pageShow (queryResult.total)!0, (queryResult.pageIndex)!0 />
    </form>
</@override>
<@override name="page-scripts">
    <script>
        $(function(){
            layui.use(['form','layer','jquery'], function(){
                var form = layui.form;
                var layer=layui.layer;
                $=layui.jquery;
                $('.js_add').on('click', function(){
                    layer.open({
                        type: 2,
                        title:'新增流程模型',
                        area: ['480px', '400px'],
                        anim: 2,
                        maxmin: false,
                        closeBtn: 1,
                        shadeClose: true,
                        shade: 0.6,
                        content: '${contextPath}/workflow/model/add'
                     })
                })
            });
        })
    </script>
</@override>
<@extends name="/layout/basepage.html"/> 